XpertRule script errors | VBScript command editing |
XpertRule supports an alternative command language syntax to that of the standard XpertRule procedural @commands. This uses a Visual basic like syntax - similar to VBScript, the subset of Visual Basic.
While the number of VBScript commands supported is not as comprehensive as XpertRule @commands, speed of execution can be many orders of magnitude faster due to more efficient tokenisation being possible. For this reason, using VBScript can be very beneficial for long procedures, especially where looping and manipulation of arrays is involved.
Note that the more specialist XpertRule @Commands do not have any equivalent in VBScript and that not all standard VBScript statements are implemented. However, there are also some custom commands included that are not standard in VBScript
Indirect Variable Referencing is not supported by VBScript in XpertRule.
You can use VBScript in a variety of places:
Procedure type Knowledge Explorer objects are specifically for use with VBScript (or @commands). They can be used to instigate the command sequence by placing the Procedure in the flow of the logic of your application wherever needed. For instance, inserted into a decision tree.
Events are provided as sub unit of most Knowledge Explorer objects. For example, a List type attribute or a Numeric attribute each have their own set of events. There are several Event windows for each object - such as OnCapture, OnLeave and OnUpdate. The difference is that Events are intrinsically tied (i.e. belong solely) to their own object and are executed when the object is encountered by the inference process. The actual timing of the event depends upon your use of the OnCapture, OnLeave and OnUpdate windows.
Calling another procedure
In VBScript procedures you can also call another VBScript procedure just by including the procedure name. This also enables XpertRule @command syntax procedures to be invoked (i.e. called from the VBScript syntax procedure). This is a useful way to utilise the more specialist XpertRule @commands that are not supported by the VBScript syntax.
Note that you can also use Events to invoke Procedures. Within an Event you can use the same method above to call a procedure. This technique is handy when you have several Events that could use some common code, and you don't want to repeat the code within each Event.